Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(concurrency): consistent node-level locks #13382

Merged
merged 1 commit into from
Aug 20, 2024

Conversation

samugi
Copy link
Member

@samugi samugi commented Jul 16, 2024

Summary

Follow-up to the (reverted): #13055 - includes a fixup commit to address some log noise issues created by the original PR.


Several places in the gateway need a node-level lock, some of them used slightly different implementations. This refactor brings consistency in the ways we do node-level locking by using the same implementation (concurrency.with_worker_mutex) everywhere.

Note: in order to maintain the logic of declarative.import unaltered, the concurrency.with_worker_mutex function has been slightly modified to return an additional value ttl in case of timeout error, so that retry_after could be implemented as before.

Checklist

  • (no/refactor) The Pull Request has tests
  • A changelog file has been created under changelog/unreleased/kong or skip-changelog label added on PR if changelog is unnecessary. README.md
  • (no) There is a user-facing docs PR against https://github.com/Kong/docs.konghq.com - PUT DOCS PR HERE

Issue reference

KAG-2337

@github-actions github-actions bot added core/clustering core/db cherry-pick kong-ee schedule this PR for cherry-picking to kong/kong-ee labels Jul 16, 2024
@samugi samugi marked this pull request as draft July 16, 2024 11:44
@samugi samugi force-pushed the refactor/concurrency-worker-mutex-2 branch 7 times, most recently from 406ac65 to 49e7450 Compare July 17, 2024 12:31
@samugi samugi marked this pull request as ready for review July 17, 2024 13:07
@AndyZhang0707 AndyZhang0707 requested review from nowNick and gruceo August 8, 2024 09:23
@AndyZhang0707
Copy link
Collaborator

Hi @gruceo could you help and review this PR? thanks

@team-eng-enablement team-eng-enablement added author/community PRs from the open-source community (not Kong Inc) and removed author/community PRs from the open-source community (not Kong Inc) labels Aug 13, 2024
Several places in the gateway need a node-level lock, some of them used
slightly different implementations. This refactor brings consistency in
the ways we do node-level locking by using the same implementation
(concurrency.with_worker_mutex) everywhere.
@samugi samugi force-pushed the refactor/concurrency-worker-mutex-2 branch from 49e7450 to 5e74999 Compare August 13, 2024 13:48
@samugi samugi merged commit f208e05 into master Aug 20, 2024
26 checks passed
@samugi samugi deleted the refactor/concurrency-worker-mutex-2 branch August 20, 2024 07:26
@team-gateway-bot
Copy link
Collaborator

Successfully created cherry-pick PR for master:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick kong-ee schedule this PR for cherry-picking to kong/kong-ee core/clustering core/db size/L skip-changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants